package graduation.claf.controller;

import graduation.claf.pojo.Record;
import graduation.claf.service.ifs.IRecordService;
import graduation.claf.utils.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/portal")
public class RecordController {

    @Autowired
    IRecordService recordService;

    @PostMapping(value = "/record/addRecord.do")
    public ServerResponse AddRecord(@RequestBody Record record){
        return recordService.AddRecord(record);
    }

    @PostMapping(value = "/record/modifyRecord.do")
    public ServerResponse modifyRecord(@RequestBody Record record){
        return recordService.modifyWithId(record);
    }

    @PostMapping(value = "/record/deleteRecord.do")
    public ServerResponse deleteRecord(String recordId){
        return recordService.deleteWithId(recordId);
    }

    @PostMapping(value = "/record/RecordList.do")
    public ServerResponse searchRecord(String bookId,int timeZone){
        return recordService.searchRecords(bookId,timeZone);
    }
}
